#ifndef MAIN_H
#define MAIN_H

#include <boost\scoped_ptr.hpp>
#include <boost\shared_ptr.hpp>
#include "global_operators.h"

#include "winapi_structure.h"
#include "..\winapi_window.h"
#include <iostream>
#include "TestTracker.h"
#include "resource.h"
#include <algorithm>

#include <boost/assign/list_of.hpp> // for 'list_of()'
#include <boost/assign/std/vector.hpp>
using namespace boost::assign; // bring 'list_of()' into scope

typedef struct BasicTestWindow : public TestTracker, public Window
{ 
	// creates a 400x300 window at (800,100) in screen coords. This is used for testing of the
	// Window class which is an abstraction for a GUI.

	BasicTestWindow(TCHAR* const testName) : TestTracker(testName) { 
		//InitWindow(testName);	
	}
	virtual ~BasicTestWindow() {}

	virtual void InitWnd(TCHAR* const windowName) {
		Window::InitWnd(xpos, ypos, width, height, windowName, NULL);
	}

	virtual WND_PROC_DECL()
	{
		if ( msg == WM_CREATE ) {
			this->hWnd = hWnd;
			Create();
		}

		if ( msg == WM_GETMINMAXINFO ) { // some of the test windows want windows with a minimum size of 50x50 pixels.
			SetPoint(((LPMINMAXINFO)lParam)->ptMinTrackSize, 50, 50);
		}

		if  (msg == WM_CLOSE ) {
			DestroyWindow();
		}

		return DEF_WND_PROC;
	}
	virtual void Test() {};
	virtual void Create() {}
	virtual void AfterCreate()
	{
		RunTest();
	}

	// default window dimensions
	const static int xpos = 100, ypos = 100, width = 400, height = 300; 

} BTW;

#define     BTW_PARAM				BTW::xpos, BTW::ypos, BTW::width, BTW::height
#define     AppInstance				GetModuleHandle(NULL)
#define		INIT_DLG_PARAM			NULL, AppInstance, MAKEINTRESOURCE(IDD_MAINDLG)
#define     S_VAR(x, y, ...)        static x& y() { static x s_##y = __VA_ARGS__; return s_##y; }
#define		S_BRUSH(x, y)			S_VAR(HBRUSH, x, CreateSolidBrush(y))
#define     S_RECT(x, ...)			S_VAR(RECT, x, __VA_ARGS__)
#define     NBRUSH				(HBRUSH)GetStockObject(NULL_BRUSH)

#define RED_BRUSH	 HBRUSH red    = CreateSolidBrush(RGB(255, 0, 0));
#define YELLOW_BRUSH HBRUSH yellow = CreateSolidBrush(RGB(255, 255, 0));  
#define ORANGE_BRUSH HBRUSH orange = CreateSolidBrush(RGB(255, 127, 0));  
#define PURPLE_BRUSH HBRUSH purple = CreateSolidBrush(RGB(223, 0, 255));  

#endif